package com.cscj.android.repository.db.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

/**
 * 首页快捷入口
 */
@Entity("short_cut_entry")
data class ShortCutEntryEntity(
    @PrimaryKey val id: Int,
    val type: Int,
    val icon: String?,
    val name: String?,
    val link: String?,
    val sortOrder: Int,
    @ColumnInfo(defaultValue = "0") val isRoot: Boolean
) {
    companion object {
        const val EntryTypeShortCut = 1 //
        const val EntryTypeFavorites = 2 //收藏夹
        const val EntryTypeHistory = 3 //历史记录
    }

    fun isFavoriteRoot(): Boolean {
        return type == EntryTypeFavorites && isRoot
    }

    fun isHistoryRoot(): Boolean {
        return type == EntryTypeHistory && isRoot
    }
}
